package com.homestead.controller.req;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.homestead.bo.CouponThemeConditionBo;
import com.homestead.bo.CouponThemeCreateBo;
import com.homestead.convert.AbstractConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author HanBin_Yang
 * @since 2021/5/29 21:54
 */
@ApiModel(description = "券配置创建 入参")
@Data
public class CouponThemeCreateRequest extends AbstractConverter<CouponThemeCreateBo> implements Serializable {
    private static final long serialVersionUID = -2079604500616281180L;

    @ApiModelProperty(value = "券主题名称", required = true)
    private String themeTitle;

    @ApiModelProperty(value = "优惠券名称", required = true)
    private String couponName;

    @ApiModelProperty(value = "券发放规则 1活动规则券 4前台领券，17主动营销 18权益优惠券 19线下预制券 20媒体广告券 21直播券 22营销活动页券", required = true)
    private Integer couponGiveRule;

    @ApiModelProperty(value = "券码生成方式 0自动生成 1第三方券码", required = true)
    private Integer couponType;

    @ApiModelProperty(value = "适用组织类型 0平台券 1集团券 2商家券 3店铺券", required = true)
    private Integer adaptOrgType;

    @ApiModelProperty(value = "优惠方式 1金额 2折扣 3福利卡 4红包券", required = true)
    private Integer couponDiscountType;

    @ApiModelProperty(value = "优惠券面值 折扣/价值 折扣则*100转换成整数", required = true)
    private Integer couponAmount;

    @ApiModelProperty(value = "折扣上限(元)", required = true)
    private BigDecimal discountLimitAmount;

    @ApiModelProperty(value = "发行总量", required = true)
    private Integer totalLimit;

    @ApiModelProperty(value = "活动开始时间", required = true)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;

    @ApiModelProperty(value = "活动结束时间", required = true)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

    @ApiModelProperty(value = "发布人群 0是会员 1是机构经纪人 2是C端用户", required = true)
    private List<Integer> pubPorts;

    @ApiModelProperty(value = "券码有效期类型  1固定有效期，2自用户领取几天后失效", required = true)
    private Integer couponValidityType;

    @ApiModelProperty(value = "固定有效期开始时间, 针对固定有效期", required = true)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date validityStartTime;

    @ApiModelProperty(value = "固定有效期结束时间, 针对固定有效期", required = true)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date validityEndTime;

    @ApiModelProperty(value = "自用户领取几天后失效, 针对自用户领取几天后失效", required = true)
    private Integer validityDays;

    @ApiModelProperty(value = "使用条件 订单满多少元可用", required = true)
    private BigDecimal useLimitAmount;

    @ApiModelProperty(value = "每个订单号每次最多可使用张数", required = true)
    private Integer orderUseLimit;

    @ApiModelProperty(value = "是否可赠送 0否 1是", required = true)
    private Boolean canGiving;

    @ApiModelProperty(value = "是否可转让 0否 1是", required = true)
    private Boolean canTransfer;

    @Override
    public CouponThemeCreateBo convert() {
        CouponThemeCreateBo bo = new CouponThemeCreateBo();
        BeanUtils.copyProperties(this, bo);
        return bo;
    }
}
